import { getSubjectTree } from "@/utils/api/subjectApi"
import { AxiosRes } from "@/utils/http"
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"

const initialState={
    userInfo:{},//用户信息
}

export const  get_subject_tree=createAsyncThunk(
    'get/suject_tree',
    async(action,state)=>{
        const res=await getSubjectTree()
        console.log(res);
        
        return res.data.data
    }
)
export const subjectSlice=createSlice({
    name:'user',
    initialState,
    reducers:{
        set_user_info:(state,action)=>{
            state.userInfo=action.payload
        }
    },
    extraReducers:(builder)=>{
        
    }
})

export const {set_user_info}=subjectSlice.actions
export default subjectSlice.reducer